//wx-drawer
const app = getApp();

const {$Message} = require('../../dist/base/index');
const Config = require('../../utils/Config.js');

Page({
    data: {},

    /**
     * 可爱的分割线 - -，以上部分是侧划栏的逻辑，以下是具体逻辑
     */
    /**------------------------------------------------------------------------------------------------**/

    //点击扫码按钮
    bindViewTap: function () {
        if(!wx.getStorageSync('username')){
            this.setData({showUnLogin:true})
            return
        }
        wx.scanCode({
            success: (res) => {
                if (!res) {
                    $Toast({
                        content: "扫描二维码错误",
                        type: 'error'
                    });
                    return
                }

                console.log(res)
                var order = res.path;
                if(!order){
                    order = res.result
                }
                if(order.indexOf("=")!==-1){
                    order = order.split("=")[1]
                }
                console.log(order)
                //将货单号，储存到缓存中
                wx.setStorageSync("order", order);
                //跳转到未签名预览中
                wx.navigateTo({
                    url: '../nosignpreview/nosignpreview'
                })
            }
        })
    }

})
